package com.sy.olddriver.model;

import com.sun.org.apache.regexp.internal.RE;
import com.sun.xml.internal.ws.resources.HttpserverMessages;
import com.sy.olddriver.annotation.Controller;
import com.sy.olddriver.annotation.RequestMapping;
import com.sy.olddriver.annotation.ResponseBody;
import com.sy.olddriver.constant.AppConstant;
import com.sy.olddriver.dto.CartInfo;
import com.sy.olddriver.entity.User;
import com.sy.olddriver.service.CartService;
import com.sy.olddriver.service.UserService;
import com.sy.olddriver.service.impl.CartServiceImpl;
import com.sy.olddriver.service.impl.UserServiceImpl;
import com.sy.olddriver.utils.CookieUtils;
import com.sy.olddriver.utils.RedisUtils;
import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.UUID;

@Controller
@RequestMapping("cart")
public class CartModel {
    private CartService cartService = new CartServiceImpl();

    @RequestMapping("addToCart")
    @ResponseBody
    public void addToCart(HttpServletRequest req, HttpServletResponse res) {
        cartService.addCart(req, res);
    }

    @RequestMapping("getCartInfo")
    @ResponseBody
    public CartInfo getCartInfo(HttpServletRequest req, HttpServletResponse res) {
        return cartService.getCartInfo(req, res);
    }

    @RequestMapping("changeNum")
    @ResponseBody
    public void changeNum(HttpServletRequest req, HttpServletResponse res) {
        cartService.changeNum(req, res);
    }

}
